﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Web.UI;

namespace WebComponents.UI.Controls
{
    [
    DefaultProperty("Text"),
    ParseChildren(false),
    ToolboxData("<{0}:ImageResource runat=\"server\"></{0}:ImageResource>")
    ]
    public class ImageResource : Panel
    {
        #region Private Member Variables
        private string imageOriginal;
        private string imageUrl;
        #endregion

        #region Properties

        [
        Bindable(true),
        Category("Appearance"),
        DefaultValue(""),
        Description("Page title."),
        Localizable(true)
        ]
        public string ImageUrl
        {
            get
            {
                return this.imageUrl;
            }
            set
            {
                this.imageUrl = value;
            }
        }
        [
        Bindable(true),
        Category("Appearance"),
        DefaultValue(""),
        Description("Page title."),
        Localizable(true)
        ]
        public string ImageOriginal
        {
            get
            {
                return this.imageOriginal;
            }
            set
            {
                this.imageOriginal = value;
            }
        }

        #endregion

        #region RenderContents

        protected override void RenderContents(HtmlTextWriter writer)
        {
            base.RenderContents(writer);
            writer.Write(" for(i;i<20;i++) { txt = txt.replace('" + this.imageOriginal.ToLower() + "', '" + Page.ClientScript.GetWebResourceUrl(this.GetType(), this.imageUrl) + "');}");
        }

        #endregion

      

        protected override void OnInit(EventArgs e)
        {

        }

    }
}
